package com.gi.product.controller;

import java.io.File;
import java.io.IOException;
import java.util.Random;

/**
 * Created by lancf on 2019/7/28.
 */
public class TestFile {
    public static void main(String[] args) {
        File file = new File("D:/111");
        if(!file.exists()){
            boolean mkdir = file.mkdir();
        }
        Random random = new Random();
        int i = random.nextInt();
        File file1 = new File("D:/111/"+i+".txt");
        if(file1.exists()){
            boolean delete = file1.delete();
        }
        try {
            boolean newFile = file1.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
